#ifndef _REG_TRANS_H
#define _REG_TRANS_H

#include <stdlib.h>
//#include "task.h"
//#include "aceMesh_stack.h"
#include <assert.h>
#include "scheduler.h"
#include "am_machine.h"

#ifdef TARG_SW9
#define CHIP_BUFF_SIZE 8
struct task_chip_buff
{
    struct task* base[CHIP_BUFF_SIZE];
    volatile int head;
    volatile int tail;
    int send_num;
    int recv_num;
};
void init_chip_queue();
void slave_clear_RegNT_to_need_spawn();
#if defined(_SERIAL_QUEUE) && defined(EMP_RANDOM_STEALING)
struct task*  emp_random_stealing();
#endif
#elif TARG_SW5
#define DROW 0
#define DCOL 1

int RegNT_full(int dir);
int RegNT_empty(int dir);
void setid();
int get_route(int scheid, int destid, int *dir, int *route);
void get_media(int my_id, int dest_id, int *dir, int *route);

struct task* recv_one_task(int dir);
void sendtask(int dir, int route, struct task* p);
#if defined(_SERIAL_QUEUE) && defined(EMP_RANDOM_STEALING)
void emp_random_stealing();
#endif
#endif

void slave_sendtask2PE(struct task* p, int destid);
int slave_recvtaskfromRegNT();




#endif
